---
title: Setting the Value of a Property
ms.prod: outlook
ms.assetid: 34fc2c20-dbdf-2947-e083-4a8014a7e915
ms.date: 06/08/2017
---


# Setting the Value of a Property

Outlook provides several ways to set the value of a property:

||Object.Property|[UserProperty.Value](userproperty-value-property-outlook.md)|[ItemProperty.Value](itemproperty-value-property-outlook.md)|[PropertyAccessor.SetProperty](propertyaccessor-setproperty-method-outlook.md)|[PropertyAccessor.SetProperties](propertyaccessor-setproperties-method-outlook.md)|
|:-----|:-----|:-----|:-----|:-----|:-----|
|**Action**|Sets the value of the specified explicit built-in property.|Sets the custom item-level property with a given value. If the property doesn't exist, setting it will return an "Object variable or with block variable not set" error.|Sets the built-in or custom item-level property with a given value, provided the property is not a read-only or blocked property. Returns a runtime error if the property does not exist.|Sets the property specified by _SchemaName_ with the given _value_, provided the property is not a read-only or blocked property. If the property does not exist, and if the provider and the parent object supports property creation, and a valid schema name is specified for the property, **SetProperty** creates the property.|For each property in _SchemaNames_, provided the property is not a read-only or blocked property, sets the property with the corresponding value in the _Values_ array. If the property does not already exist, property creation as stated in the **SetProperty** column may take place. If the two arrays _SchemaNames_ and _Values_ do not match in size, **SetProperties** will return an invalid argument error.|
|**Applicable objects**|All objects in the Outlook object model.|All [Outlook item objects](outlook-item-objects.md) except Office document items (**[DocumentItem](documentitem-object-outlook.md)** objects).|All Outlook item objects except Office document items (**DocumentItem** objects).|Use **ItemProperty** to set explicit built-in item-level properties. Use **SetProperty** for **DocumentItem** properties, item-level properties without explicit names, custom prroperties, or properties of any of the following objects: **[AddressEntry](addressentry-object-outlook.md)**, **[AddressList](addresslist-object-outlook.md)**, **[Attachment](attachment-object-outlook.md)**, **[ExchangeDistributionList](exchangedistributionlist-object-outlook.md)**, **[ExchangeUser](exchangeuser-object-outlook.md)**, **[Folder](folder-object-outlook.md)**, **[Recipient](recipient-object-outlook.md)**, and **[Store](store-object-outlook.md)**.|Same objects as stated in the **SetProperty** column.|
|**Property type matching**|As specified in the Outlook object model.|Returns a runtime error if the value does not match the property type.|Returns a runtime error if the value does not match the property type.|If _SchemaName_ uses the MAPI proptag namespace, and _Value_ does not match the property type indicated by the property tag, **SetProperty** will return a type mismatch runtime error. If _SchemaName_ uses the MAPI string namespace, **SetProperty** will attept to coerce the type to match the property type. If the type coercion fails, **SetProperty** will return a type mismatch runtime error. The **[PropertyAccessor](propertyaccessor-object-outlook.md)** does not support certain MAPI property types, for example, **PT_OBJECT**, and attempting to set the value of properties of such types will return a "Property operation not supported" error.|Property type matching is similar to **SetProperty** as each property in _SchemaNames_ is matched with the type of the value in the _Values_ array. Any error including type mismatch error is returned in the _Errors_ array.|
|**Property change events**|The **PropertyChange** event fires when a built-in item-level property changes.|The **CustomPropertyChange** event fires when the value of a custom item-level property changes.|The **PropertyChange** event fires when a built-in item-level property changes. The **CustomPropertyChange** event fires when the value of a custom item-level property changes, provided that the custom property is in the **[UserProperties](userproperties-object-outlook.md)** collection for the item. Note that an item-level property added implicitly by **[PropertyAccessor.SetProperty](propertyaccessor-setproperty-method-outlook.md)** or **[PropertyAccessor.SetProperties](propertyaccessor-setproperties-method-outlook.md)** does not automatically become part of the item's **[UserProperties](userproperties-object-outlook.md)** collection.|Changing non-item-level properties does not fire any event. Changing item-level properties fires the same events as stated in the **[ItemProperty.Value](itemproperty-value-property-outlook.md)** column. Note that an item-level property added implicitly by **SetProperty** or **SetProperties** does not automatically become part of the item's **UserProperties** collection. An explicit **[UserProperties.Add](userproperties-add-method-outlook.md)** is required to include the property so that the **CustomPropertyChange** event will fire on property change.|For each property in the _SchemaNames_ array, changing its value may fire an event depending on circumstances as described in the **SetProperty** column.|
|**Security**|No security restrictions.|Trusted and untrusted code can use **[UserProperty](userproperty-object-outlook.md)**.|Trusted and untrusted code can use **[ItemProperty](itemproperty-object-outlook.md)**.|On a client computer without an appropriately set up antivirus software, untrusted code attempting to access the **PropertyAccessor** property of an item object will by default invoke the address book security warning.|Same security considerations as in the **SetProperty** column.|
|**Performance**|No performance overhead. Use this whenever the property is an explicit built-in property.|No performance overhead. Use this object whenever the property is a custom property at the item-level.|No performance overhead. Use this object whenever the property is a named item-level property.|Using the **PropertyAccessor** to access properties incurs performance overhead. For setting multiple properties, use **SetProperties** as opposed to repeated **SetProperty**.|Using the **PropertyAccessor** to access properties incurs performance overhead. For setting multiple properties, use **SetProperties** as opposed to repeated **SetProperty**.|

## Remarks

Because the **Value** property is the default property for the **ItemProperty** and **UserProperty** objects, you do not necessarily have to explicitly specify the **Value** property when referring to the value of a property.

Similarly, the **Find** method is the default method for **[ItemProperties](itemproperties-object-outlook.md)** and **UserProperties**. You do not necessarily have to specify the **Find** method when referencing the value of a property.


